package Entidad;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="ADMINISTRADOR")
public class Administrador implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    private Long cedula;
    private String nombre;
    private char[] contrasena;
    @OneToOne
    private Sala sala;
    @Column(unique=true,nullable=false)
    private String correoUnal;
    private String otroCorreo;
    private String direccion;
    private Long telefono;

    public Administrador(Long cedula, String nombre, char[] contrasena, Sala sala, String correoUnal, String otroCorreo, String direccion, Long telefono) {
        this.cedula = cedula;
        this.nombre = nombre;
        this.contrasena = contrasena;
        this.sala = sala;
        this.correoUnal = correoUnal;
        this.otroCorreo = otroCorreo;
        this.direccion = direccion;
        this.telefono = telefono;
    }
    
    public Administrador() {
    }

    public Long getCedula() {
        return cedula;
    }

    public char[] getContrasena() {
        return contrasena;
    }

    public String getCorreoUnal() {
        return correoUnal;
    }

    public void setCorreoUnal(String correoUnal) {
        this.correoUnal = correoUnal;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public String getOtroCorreo() {
        return otroCorreo;
    }

    public void setOtroCorreo(String otroCorreo) {
        this.otroCorreo = otroCorreo;
    }

    public Long getTelefono() {
        return telefono;
    }

    public void setTelefono(Long telefono) {
        this.telefono = telefono;
    }

    public void setContrasena(char[] contrasena) {
        this.contrasena = contrasena;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Sala getSala() {
        return sala;
    }

    public void setSala(Sala sala) {
        this.sala = sala;
    }

    public void setCedula(Long cedula) {
        this.cedula = cedula;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cedula != null ? cedula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Administrador)) {
            return false;
        }
        Administrador other = (Administrador) object;
        if ((this.cedula == null && other.cedula != null) || (this.cedula != null && !this.cedula.equals(other.cedula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return cedula + " - " + nombre;
    }

}
